<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout}">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

    <title th:text="#{cas.mfa.yubikey.pagetitle}">YubiKey Registration View</title>
    <link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag" />
</head>

<body>
    <main role="main" class="container mt-3 mb-3">
        <div layout:fragment="content" id="login" class="mdc-card mdc-card-content w-lg-50 p-4 m-auto">
            <form method="post" id="yubiKeyForm">
                <div class="banner banner-danger my-2" th:if="${flowRequestContext.messageContext.hasErrorMessages()}">
                    <p th:each="message : ${flowRequestContext.messageContext.allMessages}"
                       th:utext="#{${message.text}}">Message Text</p>
                </div>
                <div class="alert alert-info" th:text="#{cas.mfa.yubikey.register}">
                    Your device is not yet registered. Use the below form to register your device with CAS.
                </div>
                <section class="cas-field my-3 mdc-input-group">
                    <div class="mdc-input-group-field mdc-input-group-field-append">
                        <div
                            class="mdc-text-field  mdc-text-field--with-trailing-icon d-flex caps-check">
                            <input class="mdc-text-field__input pwd" type="password" required id="token" size="25"
                                th:name="token" th:accesskey="#{screen.welcome.label.password.accesskey}"
                                autocomplete="off" />
                            <label for="token" class="mdc-floating-label" th:utext="#{cas.mfa.yubikey.label.token}">Token</label>
                        </div>
                        <div class="mdc-text-field-helper-line caps-warn">
                            <p
                                class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent mdc-text-field-helper-text--validation-msg text-danger">
                                <span th:utext="#{screen.capslock.on}" />
                            </p>
                        </div>
                    </div>
                    <button class="reveal-password mdc-button mdc-button--raised mdc-input-group-append mdc-icon-button"
                        type="button">
                        <i class="mdi mdi-eye reveal-password-icon"></i>
                        <span class="sr-only">Toggle Password</span>
                    </button>

                </section>
                <div class="mdc-text-field d-flex">
                    <input class="mdc-text-field__input" id="accountName"
                           name="accountName" size="50" type="text" autocomplete="off"/>
                    <label for="accountName" class="mdc-floating-label"
                           th:utext="#{screen.authentication.yubikey.name}">Name</label>
                    <script>document.getElementById("accountName").value = randomWord();</script>
                </div>
                <br>

                <button class="mdc-button mdc-button--raised" accesskey="s">
                    <span class="mdc-button__label" th:text="#{screen.welcome.button.register}">Register</span>
                </button>
                <input type="hidden" name="_eventId_submit" value="Register" />
                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
            </form>
        </div>
    </main>
</body>

</html>
